<table id="Lay-gateway-detail-list" lay-filter="gateway-table" lay-even></table>

<script type="text/html" id="status">
    {{# if(d.status === 'OnLine') { }}
    <span class="layui-badge-dot dot-style" style="background:rgb(82, 196, 26)"></span>在线
  {{#  }else{ }}
  <span class="layui-badge-dot dot-style"></span>离线
  {{# } }}
</script>

<script type="text/html" template lay-done="layui.data.postData(d.params)"></script>

<script>
    layui.data.postData = function(params){
        console.log(params);
        layui.use(['admin', 'setter', 'table', 'view'], function() {
			var $ = layui.$,
				admin = layui.admin,
				setter = layui.setter,
				table = layui.table, 
				view = layui.view;
            table.render({
                elem:'#Lay-gateway-detail-list',
                url:setter.url + '/gateway/getByGatewayDevice',
                method:'post',
                where:{
                    serialNumber:params.serialNumber,
                    type:params.type,
                    token:layui.data(layui.setter.tableName).token
                },
                request:{
                    pageName:'pageindex',
                    limitName:'pagesize'
                },
                response:{
                    statusName:'code',
                    statusCode:200,
                    msgName:'message',
                    countName:'count',
                    dataName:'rows'
                },
                page:true,
                cols:[[
                    {field:'deviceCode',title:'设备ID'},
                    {field:'deviceName',title:'设备名称'},
                    {field:'productName',title:'产品'},
                    {title:'状态',templet:'#status'}
                ]]

            })
        
        });
    }
</script>

